#ifndef RBQTAPPLICATION_H
#define RBQTAPPLICATION_H

#include <RB.h>
#include <RBApplication/RBApplication.h>

#include <QtGui/QMainWindow>
#include "ui_RBQtApplication.h"
#include <QTGui/QFileDialog>

#include <QTCore/QTimer>

class RBTechniqueParameter;
class QSignalMapper;

class RBQtApplication : public QMainWindow
{
	Q_OBJECT

public:
	            RBQtApplication(QWidget *parent = 0, Qt::WFlags flags = 0);
	           ~RBQtApplication();

    void        PopulateTreeView(RBSceneNode* pRoot);
    
    template<class RBTEntity>
    void        AddEntityToTree(RBTEntity* pObject)
    {
        AddEntityToTreeItem(pObject, NULL);
    }
    
    QTreeWidgetItem*        AddEntityToTreeItem(RBSceneObject* pObject, QTreeWidgetItem* parent);

public slots:
	void        OnFileLoad	        ();
    void        OnFileSave	        ();
    void        OnIdle	            ();
    void        OnUpdateMaterial    (const QModelIndex& index);
    void        OnLoadTexture       (int iSampler);
    void        OnReloadShaders     ();
    void        OnLightCreate       ();

private:
    void        UpdateMaterialWnd   ();
    void        AddTechniqueParameter(const RBTechniqueParameter* pParam);

private:
	Ui::RBQtApplicationClass ui;
    QTimer      m_qtTimer;
    std::map<QTreeWidgetItem*, RBSceneObject*> m_TreeToObjects;
    RBGeometry* m_pEditableGeometry;
    QSignalMapper* m_pSignalMapper;

};

#endif // RBQTAPPLICATION_H
